﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Sql_Windows_Sp_Tools.Common
{
    public class RichTextBoxConsoleHelper
    {
        public static void OutMsg(RichTextBox rtb, string msg, Color color)
        {
            rtb.BeginInvoke(new EventHandler(delegate
            {
                rtb.SelectionStart = rtb.Text.Length;//设置插入符位置为文本框末
                rtb.SelectionColor = color;//设置文本颜色
                rtb.AppendText(msg + "\r\n");//输出文本，换行
                rtb.ScrollToCaret();//滚动条滚到到最新插入行
            }));
        }
    }
}
